//
//  ORDataItem.m
//  OR_1
//
//  Created by Luboš Kulič on 8/21/10.
//  Copyright 2010 __MyCompanyName__. All rights reserved.
//

#import "ORDataItem.h"


static NSString * parsedElementName_ = @"D:Vypis_OR";


static NSArray * ORDataItemViewSections;




@implementation ORDataItem


+(void) initialize {
	ORDataItemViewSections = [[NSArray arrayWithObjects: 
		 @"basicInfo"
		,@"businesses"
		,@"statutoryBodies"
		,nil
		] retain];
	
}

+(void) load {
	NSLog(@"parsedElementName_: %@", parsedElementName_);
	[super registerParser:self  ForElement:parsedElementName_];	
}

-(id) init {
	if(!(self = [super init])) {
		return 0;
	}
	self->rootElementName_ = parsedElementName_;
	return self;
}


-(NSUInteger) numberOfValues {
	//NSUInteger i = [ORDataItemViewSections count];
	NSLog(@"Num 1");

	NSLog(@"Number of values: %@" ,ORDataItemViewSections);//, [ORDataItemViewSections count]);
	
	return [ORDataItemViewSections count];
	NSLog(@"Number of values end");
}

-(id) valueForIndex:(int)index {
	return [self valueForKey:[ORDataItemViewSections objectAtIndex:index]];
}



/******************************************************************************************/

-(void) parserWillStartSubelement:(NSString *)elementName withWorker:(XMLParserWorker *)newWorker {
	// store subelement into a proper list
	if ([@"D:ZAU" isEqualToString:elementName]) {
		self->basicInfo = [(ORBasicInfo *) newWorker retain];
	}
}

-(void) parserDidEndRootElementWithData:(NSString *)parsedElementData{
	// get data from data dictionary and store them into the proper attributes
	
	
}


/******************************************************************************************/

-(NSString *) description {
	return [NSString stringWithFormat:@"ORDataItem {\nBasic Info: %@\nBusinesses: %@\nStatutory Bodies: %@\n}",
			basicInfo, businesses, statutoryBodies ];
	
}

@end
